package cn.wolfcode.wolf2w.business.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {
    //获取传入日期对象当天的最后一一分一秒
    public static Date getEndDate(Date date){
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        return calendar.getTime();
    }

    //计算两个Date对象之间的毫秒数
    public static long getDateBetween(Date d1, Date d2) {
      return Math.abs(d1.getTime() - d2.getTime())/1000;
    }


}
